package com.glsc.ngateway.common.base.domainmapper;

import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.flow.FlowConfig;
import com.glsc.ngateway.common.api.flowable.dto.task.config.FlowConfigDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @Author: xuchang
 * @Desc: domin到dto转换
 */

/**
 * @Mapper自动生成接口实现类，完成domin与dto转换，componentModel=spring：规定实现类的组件类型，自动在实现类上加@Components注解，可以通过@Autowired引入实现类
 */
@Mapper(componentModel = "spring")
public interface FlowConfigMapper {

    FlowConfigMapper INSTANCE = Mappers.getMapper(FlowConfigMapper.class);

    @Mapping(target = "editConfigDto", ignore = true)
    @Mapping(target = "value", ignore = true)
    FlowConfigDto do2Dto(FlowConfig domain);

    List<FlowConfigDto> do2Dto(List<FlowConfig> domain);

    @Mapping(target = "insertTime", ignore = true)
    @Mapping(target = "updateTime", ignore = true)
    @Mapping(target = "deleted", ignore = true)
    @Mapping(target = "value", ignore = true)
    FlowConfig dto2Do(FlowConfigDto dto);

    List<FlowConfig> dto2Do(List<FlowConfigDto> dto);
}
